<%@include file="/WEB-INF/common/taglibs.jsp"%>
<script type="text/javascript" src="${ctx}/resources/js/datatable-query.js"></script>
<link href="${supr}/plugins/gallery/pretty-photo/prettyPhoto.css" type="text/css" rel="stylesheet" />


 <script type="text/javascript" src="${supr}/plugins/gallery/pretty-photo/jquery.prettyPhoto.js"></script>

<div class="row-fluid">
				<div class="box">
					<div class="title">
 						<h4>
							<span class="icon16 icomoon-icon-filter"></span> <span>Filter</span>
						</h4>
						<a href="#" class="minimize">Minimize</a>
					</div>
					<div class="content clearfix form-horizontal">

						<div class="form-row row-fluid">
							<div class="span4">
								<label class="form-label span6">UnitNumber</label> <input
									class="span6 filterdata" type="text" field="unitNumber" op="cn" />
							</div>
										<div class="span4">
								<label class="form-label span6">Status</label>
								<div class="span6 controls">
										<select field="status" class="filterdata" op="eq">
										<option value="">====================</option>
										 <c:if
														test="${not empty statuses}">
														<c:forEach var="single" items="${statuses}">
															<option value="${single}">${single}</option>
														</c:forEach>
										</c:if>

									</select>
								</div>
							</div>
						</div>

						<div class="form-row row-fluid">
							<div class="span4">
								<label class="form-label span6">From</label> <input
									class="filterdata span6 datepicker" type="text" field="submitDate" op="ge" />
							</div>
								<div class="span4">
								<label class="form-label span6">To</label> <input
									class="filterdata span6 datepicker" type="text" field="submitDate" op="le" />
							</div>
						</div>
						<hr />


					</div>
				</div>
		 
		</div>
<div class="row-fluid">
<div class="span12">
<div class="box gradient">
<div class="title">
<h4 class="button-bar"><span>Feedback </span></h4>
<a href="#" class="minimize">Minimize</a></div>
<div class="content scrollable clearfix">
<table class="ajaxTable display table table-bordered">
	<thead>
		<tr>
			<th><a id="select_all"><span
				class="icomoon-icon-checkmark-2"></span></a></th>
			<th>Id</th>
			<th>Name</th>
			<th>Email</th>
			<th>Moblie</th>
			<th>Comment</th>
			<th>Unit Number</th>
			<th>Submit Date</th>
			<th>Status</th>
 			<th>Pics</th>
		</tr>
	</thead>
</table>
</div>
</div>

</div>

<a href="${ctx}/admin/feedback/generate/" class="btn btn-info"> <span
	class="icon12 icomoon-icon-plus white"></span> Generate</a></div>


<script type="text/javascript">

var render = false;
 
$(document).ready(function () {
	
	
	
	
	
 	johnny.oTable = $('.ajaxTable').dataTable({
		"bLengthChange": true,
		"aoColumnDefs" : [ {
			'bSortable' : false,
			'aTargets' : [ 0 ]
		} ],
		"sAjaxSource": '${ctx}/admin/feedback/',
		"fnInitComplete": function (oSettings, json) { }
	});
	var name = $("<input>").attr({
		type: "text",
		field: "unitNumber",
		op: "cn",
		placeholder: "Unit Number",
		class: "filterdata"
	});
	
	johnny.initTableQuery();
	var config = {
			id : 'del',
			text  : 'Del',
			domain : "FeedBacl",
			operation : "Delete",
			url : "${ctx}/admin/feedback/del/"
	};
	johnny.tableBtn(config);
	
	
	var pending = {
			id : 'pending',
			text  : 'Pending',
			domain : "FeedBacl",
			operation : "Pending",
			url : "${ctx}/admin/feedback/pending/"
	};
	johnny.tableBtn(pending);
	
	
	var close = {
			id : 'close',
			text  : 'Close',
			domain : "FeedBacl",
			operation : "Close",
			url : "${ctx}/admin/feedback/close/"
	};
	johnny.tableBtn(close);

	
});
function updateGrid() {
	window.clearTimeout(oTime);
	oTime = setTimeout(function () { oTable.fnDraw(); }, 500);
}

var columnHeader = ['','id','name', 'email','mobile','comment','unitNumber'];
var QueryData = function (aoData) {
	return johnny.initQueryData(aoData, columnHeader);
}

var DataTableForm = function (json, echo) {
	var dataArray = new Array();
	for (var i = 0; i < json.result.length; i++) {
		var subArray = new Array();
		var value = johnny.getForSelect(json.result[i].id);
 		subArray.push(value);
 		subArray.push(json.result[i].id);
		subArray.push(json.result[i].name);
		subArray.push(json.result[i].email);
		subArray.push(json.result[i].mobile);
		subArray.push(json.result[i].comment);
		subArray.push(json.result[i].unitNumber);
		subArray.push(json.result[i].submitDate);
		subArray.push(json.result[i].status);
		if (json.result[i].backImages.length >0){
			var arr = new Array();
			$(json.result[i].backImages).each(function(step,value){
				arr.push(value.path);				
 			});
			subArray.push(johnny.getImageHtml(arr));
 			
 		}else{
    		subArray.push("");
 			
 		}
		
		
		dataArray.push(subArray);
	}
	return {
		sEcho: echo,
		iTotalRecords: json.totalCount,
		iTotalDisplayRecords: json.totalCount,
		aaData: dataArray
	};
}
</script>
<body>